/*
 *  $Id: Point.cs 1205 2010-11-23 15:50:19Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2010 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

using AgateLib.Geometry;

using Nereal.Serialization;
using Nereal.Serialization.TypeInfos;

namespace Ragima.Serialization {
    [TypeInfo(typeof(Point))]
    public class PointTypeInfo : ValueTypeInfo<Point> {
        public override bool Equals(Point a, Point b) {
            return a == b;
        }

        public override Point ConvertFromString(string value) {
            var data = IntArrayConverter.GetArray(value, 2);
            return new Point(data[0], data[1]);
        }

        public override string ConvertToString(Point value) {
            return IntArrayConverter.GetString(value.X, value.Y);
        }
    }
}
